import java.io.File;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-09-09
 * Time: 13:14
 */
public class demo {

    public static void scan(File file) {
        if (!file.isDirectory()) {
            return;
        }
        File[] files = file.listFiles();
        for (int i = 0; i < files.length; i++) {
            if (files[i].isDirectory()) {
                //如果是目录
                System.out.println(files[i].getAbsolutePath());
                scan(files[i]);
            } else {
                System.out.println(files[i].getName());
            }
        }
    }

    public static void main(String[] args) {
        File file = new File(".");
        scan(file);
    }
}
